<%@ page language="java"
	import="java.util.*,bc.swim2.ejb.entity.Ability"
	import="java.util.*,bc.swim2.ejb.entity.RegisteredUser"
	contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>My Abilities</title>
<style>
@import url(css/main.css);
</style>
</head>
<body>
	<div id="allContainer">
		<div id="titleContainer">
			<%
				RegisteredUser currentUser = (RegisteredUser) (session
						.getAttribute("currentSessionUser"));
			%>
			<img src="img/swimScritta.gif" id="imageFloat" width=100px;
				height="100px">
			<h1 id="userHomeTitle">
				Welcome,
				<%=currentUser.getFirstName() + " "
					+ currentUser.getLastName()%>!
			</h1>
		</div>
		<div id="container">
			<div id="navigationContainer">
				<a href="MainServlet?to=RegisteredUserHome" id="linkRef">Home</a> <br />
				<a href="MainServlet?to=SearchHelp" id="linkRef">Search Help</a> <br />
				<a href="MainServlet?to=SearchUsers" id="linkRef">Search Users</a> <br />
				<a href="MainServlet?to=MyAbilities" id="linkRef">Declare/Remove
					ability</a> <br /> <a href="MainServlet?to=FriendshipRequests"
					id="linkRef">Friendship Requests</a> <br /> <a
					href="MainServlet?to=Friends" id="linkRef">Your Friends</a> <br />
				<a href="MainServlet?to=MyFeedback" id="linkRef">Feedback</a> <br />
				<a href="MainServlet?to=AbilityRequest" id="linkRef">Ability
					Request</a> <br /> <a href="LoginServlet?methodName=logout"
					id="linkRef">Logout</a>
			</div>
			<div id="actionContainer">
				<h1 id="listTitle">Your abilities:</h1>

				<%
					List<Ability> abilities = null;
					abilities = (List<Ability>) request.getAttribute("abilityList");
				%><table>
					<%
						for (Ability a : abilities) {

							String abilityName = a.getName();
					%>
					<tr>
						<td><%=abilityName%></td>
						<td>
							<form action=AbilityServlet method="POST">
								<input type="hidden" name="abilityId" value=<%=a.getId()%>>
								<input type="hidden" name="methodName" value="userRemove">
								<input type="submit" id="submitInputA" value="Remove">
							</form>
						</td>
					</tr>
					<%
						}
					%>
				</table>
				<div>
					<br>
					<form action="AbilityServlet" method="POST">
						<input type="hidden" name="methodName" value="userDeclare">
						<select name="selectedAbilityId" size="1">

							<%
								List<Ability> allAbilities = (List<Ability>) request
										.getAttribute("remainingAbilityList");

								for (Ability a : allAbilities) {

									int abilityId = a.getId();
									String abilityName = a.getName();

									out.println("<option value=" + abilityId + ">" + abilityName
											+ "</option>");
								}
							%>
						</select> <input type="submit" id="submitInputA" value="Declare">
					</form>
				</div>
			</div>
		</div>
	</div>


</body>
</html>